package com.lbxz.ocrapi.exception;

public class ServiceException extends RuntimeException{
    private int code;

    private String message;

    public ServiceException(int code, String message){
        this.code = code;
        this.message = message;
    }

    public ServiceException(String message, Throwable e){
        super(message, e);
        this.message = message;
    }

    public ServiceException(ExceptionEnum exceptionEnum){
        this.message = exceptionEnum.getMessage();
        this.code = exceptionEnum.getCode();
    }

    @Override
    public String getMessage() {
        return message;
    }

    public int getCode(){
        return code;
    }
}
